﻿#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// Class used as guid based enumeration list that holds the possible types for Branch Attribute (implemented with the Guid's hardcoded as properties to enable the text to change, but Guid's must remain or code change is necessary!!!)
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.BusinessLogic.DataAccess.LinqSProcBranchAttributeTypeFactory, DataAccess")]
    public class BranchAttributeTypeList : MarketPulseNameValueListBase<Guid, string>
    {
        #region Member Variables

            /// <summary>
            /// List to hold all the possible BranchAttribute types
            /// </summary>
            private static BranchAttributeTypeList mBranchAttributeTypes;

        #endregion

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// via only the static factory methods provided.
            /// </summary>
            private BranchAttributeTypeList()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to get a list of name/value pairs representing BranchAttributeTypes 
                /// from the database.  Internally this accesses a static field so this
                /// class is effectively a lazily instantiated singleton.
                /// </summary>
                public static void GetList(EventHandler<DataPortalResult<BranchAttributeTypeList>> callback)
                {

                    if (mBranchAttributeTypes == null)
                    {
                        DataPortal.BeginFetch<BranchAttributeTypeList>((o, e) =>
                        {
                            mBranchAttributeTypes = e.Object;
                            callback(o, e);
                        });
                    }
                    else
                    {
                        callback(null, new DataPortalResult<BranchAttributeTypeList>(mBranchAttributeTypes, null, null));
                    }
                }

                /// <summary>
                /// Method used to get a list of name/value pairs representing BranchAttributeTypes 
                /// from the database.  Internally this accesses a static field so this
                /// class is effectively a lazily instantiated singleton.
                /// </summary>
                public static void GetList()
                {
                    // Load the list if it's null
                    if (mBranchAttributeTypes == null)
                    {
                        mBranchAttributeTypes = DataPortal.Fetch<BranchAttributeTypeList>();
                    }
                }

            #endregion

        #endregion

        #region Properties
       
            /// <summary>The Guid for the 'DriveThrough' Status</summary>
            public static Guid DriveThrough { get { return new Guid("3946BEE0-8880-49EA-B779-5C603DFA5A57"); } }

        #endregion

    }
}
